package com.second.mapper;

import com.github.pagehelper.Page;
import com.second.model.pojo.FShop;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Repository
public interface FShopDao extends JpaRepository<FShop,Integer> {

    List<FShop> findAllByCityOrProvinceOrAreaContainsOrPlace(String province, String city, String area ,String place);
    @Query(value = "select * from f_shop order by shop_score desc ",nativeQuery = true)
    List<FShop> findAllByShopScore();
    @Query(value = "select * from f_shop where shop_name like %:name%",nativeQuery = true)
    List<FShop> findByShopName( @Param("name") String shopName);
    @Query(value = "select * from f_shop where consumption between ? and ? ",nativeQuery = true)
    List<FShop> findByConsumption(Double start, Double end);

    //    @Select("select * from f_shop where type=#{value}")
    Page<FShop> findByType(Integer type, Pageable pageable );

    //    @Select("select * from f_shop where area=#{value}")
    List<FShop> findByArea(String area);


    //    @Select("select id,shop_name,shop_picture,type from f_shop where area=#{value}")
    List<FShop> findAllByArea(String area);

}

